﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<script>
    var keyValue = $.request("keyValue");
    $(function () {
        if (!keyValue) {
            var str = "";
            str += "<th class=\"formTitle\">密码</th> <td class=\"formValue\"> <input id=\"F_UserPassword\" name=\"F_UserPassword\" type=\"password\" class=\"form-control required\" placeholder=\"请输入密码(否则为默认密码:123456)\"/></td>";
            $("#mm").append(str);
        }
        initControl();
        if (!!keyValue) {
            $.ajax({
                url: "/SystemManage/User/GetFormJson",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                    $("#F_Account").attr('disabled', 'disabled');
                    //$("#F_DutyId").attr('disabled', 'disabled');
                    //$("#Gongzixishu").attr('disabled', 'disabled');
                    //$("#GongziDanjia").attr('disabled', 'disabled');
                    //$("#F_UserPassword").val("******").attr('disabled', 'disabled');

                }
            });
        }
    });
    function initControl() {
        $("#F_Gender").bindSelect(),
            $("#F_IsAdministrator").bindSelect(),
            $("#F_EnabledMark").bindSelect(),
            //$("#F_OrganizeId").bindSelect({
            //    url: "/SystemManage/Organize/GetTreeSelectJson"
            //});
            $("#F_DepartmentId").bindSelect({
                url: "/SystemManage/Organize/GetTreeSelectJson",
            });
        $("#F_RoleId").bindSelect({
            url: "/SystemManage/Role/GetGridJson",
            id: "F_Id",
            text: "F_FullName"
        });
        $("#F_DutyId").bindSelect({
            url: "/SystemManage/Duty/GetGridJson",
            id: "F_Id",
            text: "F_FullName"
        });
    }
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        $.submitForm({
            url: "/SystemManage/User/SubmitForm?keyValue=" + keyValue,
            param: $("#form1").formSerialize(),
            success: function () {
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        });
    };
</script>
<form id="form1">
    <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
        <ul class="nav nav-tabs">
            @*<li class="active"><a href="#">基本信息</a></li>*@
            @*<li ><a href="#">扩展信息</a></li>*@
        </ul>
        <div style="padding-top: 20px; margin-right: 30px;">
            <table class="form">
                <tr id="mm">
                    <th class="formTitle">账户</th>
                    <td class="formValue">
                        <input id="F_Account" name="F_Account" type="text" class="form-control required" placeholder="长度为5-16字符(不允许中文字符开头)" />
                        @*<span class="xing" style="color:red">*长度为5-16字节，不允许中文字符开头 </span>*@
                    </td>
                    @*<th class="formTitle">密码</th>
                    <td class="formValue">
                        <input id="F_UserPassword" name="F_UserPassword" type="password" class="form-control required" placeholder="请输入密码(否则为默认密码:123456)" />
                    </td>*@
                </tr>
                <tr>
                    <th class="formTitle">姓名</th>
                    <td class="formValue">
                        <input id="F_RealName" name="F_RealName" type="text" class="form-control required" placeholder="请输入姓名" />
                    </td>
                    <th class="formTitle">部门</th>
                    <td class="formValue">
                        <select id="F_DepartmentId" name="F_DepartmentId" class="form-control required">
                            <option value="">==请选择==</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">角色</th>
                    <td class="formValue">
                        <select id="F_RoleId" name="F_RoleId" class="form-control required">
                            <option value="">==请选择==</option>
                        </select>
                    </td>
                    <th class="formTitle">岗位</th>
                    <td class="formValue">
                        <select id="F_DutyId" name="F_DutyId" class="form-control required">
                            <option value="">==请选择==</option>
                        </select>
                    </td>
                </tr>
                @*<tr>
                    <th class="formTitle">班次</th>
                    <td class="formValue">
                        <select id="Banci" name="Banci" class="form-control required">
                            <option value="甲">甲</option>
                            <option value="乙">乙</option>
                            <option value="丙">丙</option>
                        </select>
                    </td>
                </tr>*@
                <tr>
                    <th class="formTitle">类型</th>
                    <td class="formValue">
                        <select id="F_IsAdministrator" name="F_IsAdministrator" class="form-control">
                            <option value="false">普通用户</option>
                            <option value="true">系统管理员</option>
                        </select>
                    </td>
                    <th class="formTitle">允许登录</th>
                    <td class="formValue">
                        <select id="F_EnabledMark" name="F_EnabledMark" class="form-control">
                            <option value="true">是</option>
                            <option value="false">否</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">手机</th>
                    <td class="formValue">
                        @*<input id="F_MobilePhone" name="F_MobilePhone" type="text" class="form-control required isMobile" />*@
                        <input id="F_MobilePhone" name="F_MobilePhone" type="text" class="form-control" placeholder="请输入手机号（可不填）" />
                    </td>
                    @*<th class="formTitle">工资系数</th>
                    <td class="formValue">
                        <input id="Gongzixishu" name="Gongzixishu" type="text" class="form-control" placeholder="请输入工资系数" />
                    </td>*@
                </tr>
                <tr>
                    <th class="formTitle">工资系数</th>
                    <td class="formValue">
                        <input id="Gongzixishu" name="Gongzixishu" type="text" class="form-control" placeholder="请输入工资系数" />
                    </td>
                    <th class="formTitle">单价</th>
                    <td class="formValue">
                        <input id="GongziDanjia" name="GongziDanjia" type="text" class="form-control" placeholder="请输入单价" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle" valign="top" style="padding-top: 5px;">
                        备注
                    </th>
                    <td class="formValue" colspan="3">
                        <textarea id="F_Description" name="F_Description" class="form-control" style="height: 60px;"></textarea>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</form>
